@extends("/paging_template")
@import com.mgfireworks.mgplatform.mgadmin.user.model.Role
@args List<Role> roleList
<s_panel>
	<s_title slot="title">请选择角色</s_title>
    <s_buttons slot="button" cols="3">
        <s_button type="query"></s_button>
        <s_button id="jsBtnSelect" type="select">选择</s_button>
        <s_button id="jsBtnCancelAndBack" type="del">取消</s_button>
    </s_buttons>
</s_panel>

<d_table>
    <d_tr slot="head">
        <d_th class="td_row_id"></d_th>
        <d_th>角色编号</d_th>
        <d_th>角色名称</d_th>
    </d_tr>
    @if(roleList){
    @{int i=0;}
    @for(Role p : roleList){
    <d_tr slot="body" class="table_row @(i%2==0?"odd":"event")">
    @{i++;}
    <d_td class="td_row_id">
        <input type="checkbox" class="flat" name="__recordId" value="@p.getRoleId()"/>
    </d_td>
    <d_td>@p.getRoleId()</d_td>
    <d_td>@p.getRoleName()</d_td>
    </d_tr>
    }}
</d_table>

@section(script1){
<script type="text/javascript">
    $(function(){
        $("#jsBtnSelect").unbind("click").click(function() {
            var tds=$(".table_row.selected td");
            if(tds.length>0){
                util.el.postBack({userRole:$(tds[1]).text(),roleName:$(tds[2]).text()});
            }
            return false;
        });
    });
</script>
}